package com.luckdraw.util;
import java.util.Map;

import org.apache.commons.lang.StringUtils;

public class SignUtil {

	public static String createSign(Map<String, Object> m,String signKey) {
		StringBuilder sb = new StringBuilder();
		for(String key:m.keySet()){
			if ("sign".equals(key) || StringUtils.isEmpty((String) m.get(key))) {
				continue;
			}
			sb.append(key).append("=").append(m.get(key)).append("&");
		}
		sb.append("key=");
		sb.append(signKey);
		String packageSign = "";
		try {
			packageSign = SecurityUtil.md5(sb.toString()).toUpperCase();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return packageSign;
	}
	
}
